<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="renderer" content="webkit">
    <title>后台登录</title>
    <link href="__CSS__/bootstrap.css" rel="stylesheet">
    <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__CSS__/style.min.css" rel="stylesheet">
    <link href="__CSS__/login.min.css" rel="stylesheet">
    <!--<script src="http://static.geetest.com/static/tools/gt.js"></script>-->

    <script>
        if(window.top!==window.self){window.top.location=window.location};
    </script>
</head>

<body class="signin">
<div class="signinpanel">
    <div class="row" >
        <div class="col-sm-7" style="color:#fff;">
            <div class="signin-info" >
                <div class="logopanel m-b" >
                </div>
                <div class="m-b" ></div>
                <h2 style="position: relative;left: 133px;">欢迎使用支分宝数据管理系统</h2>
                <ul class="m-b">
                </ul>
            </div>
        </div>
        <div class="col-sm-6" style="color:#fff;height:265px;float:left;text-align: center; line-height:290px;">
            <img src="/static/admin/images/logo.png" alt="" width="100%" height="140%" style="position: relative;top: -40px;left: 80px;">
        </div>
        <div class="col-sm-5">
            <form onsubmit="return false;">
                <p class="m-b-md" style="text-align:center;font-size:15px;color:#fff;">登录到后台管理</p>
                <p id="err_msg" style="color:#ec4758;margin-left:11px;"></p>
                <input type="text" class="form-control uname" placeholder="请输入帐号" id="username" name="username" autocomplete="off" style="height:36px;border-radius: 2px;"/>
                <input type="password" class="form-control pword m-b" placeholder="请输入密码" id="password" name="password" autocomplete="off" style="height:36px;border-radius: 2px;"/>
                <button type="button" id="login" class="btn btn-primary btn-block" style="outline:none;" >登　录</button>
            </form>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left" style="color:#fff">
            &copy; 2016 All Rights Reserved.
        </div>
    </div>
</div>
<script src="__JS__/plugins/layui/layui.js"></script>
<script src="__JS__/jquery.min.js?v=2.1.4"></script>
<script src="__JS__/bootstrap.js?v=3.3.6"></script>
<script src="__JS__/jquery.form.js"></script>
<script src="__JS__/wk.js"></script>
<script>
    layui.config({
        base: '/src/'
    }).extend({
        index: 'index',
    }).use(['index']),function(){};
</script>
 <script>
     $("#login").on('click', function () {
         var name = $.trim($('#username').val())
             ,pass = $.trim($('#password').val());
         if( '' == name){
             layer.msg('请输入登录帐号',{icon:2,time:1500,anim: 6});
             $('#username').focus();
             return false;
         }

         if( '' == pass){
             layer.msg('请输入登录密码',{icon:2,time:1500,anim: 6});
             $('#password').focus();
             return false;
         }
         $(".btn").addClass('disabled').html('登录中... &nbsp;&nbsp;&nbsp;<i class="fa fa-spinner fa-pulse"></i>');
         $.ajax({
             url:"{:url('doLogin')}",
             data:{username:name,password:pass},
             dataType:"JSON",
             type:"POST",
             success:function (data) {
                 if(data.code==1){
                     console.log(data.url)
                     location.href = data.url;
                 }else{
                    layer.msg(data.msg,{icon:2,time:1500,anim: 6});
                    $(".btn").removeClass('btn-danger').removeClass('disabled').addClass('btn-primary').text("登　录");
                 }
             }
         })
     })
     // {:url('doLogin')}

// $(function(){
//     $('#username').focus();
//     $('#doLogin').ajaxForm({
//         beforeSubmit: checkForm,
//         success: complete,
//         dataType: 'json',
//         error:function(event, xhr, options, exc){
//
//             $(".btn").removeClass('btn-danger').removeClass('disabled').addClass('btn-primary').text("登　录");
//         }
//     });
//
//     function checkForm(){
//         if( '' == $.trim($('#username').val())){
//             layer.msg('请输入登录帐号',{icon:2,time:1500,anim: 6});
//             $('#username').focus();
//             return false;
//         }
//
//         if( '' == $.trim($('#password').val())){
//             layer.msg('请输入登录密码',{icon:2,time:1500,anim: 6});
//             $('#password').focus();
//             return false;
//         }
//
//         $(".btn").addClass('disabled').html('登录中... &nbsp;&nbsp;&nbsp;<i class="fa fa-spinner fa-pulse"></i>');
//     }
//
//
//     function complete(data){
//         if(data.code==1){
//             location.href=data.url;
//         }else{
//             layer.msg(data.msg,{icon:2,time:1500,anim: 6});
//
//             $(".btn").removeClass('btn-danger').removeClass('disabled').addClass('btn-primary').text("登　录");
//             return false;
//         }
//     }
//
// });
    history.pushState(null, null, document.URL);
    window.addEventListener('popstate', function () {
        history.pushState(null, null, document.URL);
    });

</script>
</body>
</html>